import request from '@/axios/request'
import url from '@/axios/url'
const { mesUrl, adminUrl, wmsUrl } = url()
// 导出url
export const exportUrl = `${mesUrl}mesProdOrder/export`

/**
 * 新增
 * @param data
 * @returns {*|Promise<*>}
 */
export function quoteOrderCreate(data = '') {
  return request({
    url: `${mesUrl}quote/order/c`,
    method: 'post',
    data: data
  })
}

/**
 * 修改
 * @param data
 * @returns {*|Promise<*>}
 */
export function quoteOrderUpdate(data = '') {
  return request({
    url: `${mesUrl}quote/order/u`,
    method: 'post',
    data: data
  })
}
export function quoteConfirmUpdate(data = '') {
  return request({
    url: `${mesUrl}quote/confirm/u`,
    method: 'post',
    data: data
  })
}
/**
 * 分页
 * @param data
 * @returns {*|Promise<*>}
 */
export function quoteOrderPage(data = {}) {
  return request({
    url: `${mesUrl}quote/order/page`,
    method: 'get',
    params: data
  })
}
export function quoteConfirmPage(data = {}) {
  return request({
    url: `${mesUrl}quote/order/page`,
    method: 'get',
    params: {
      ...data,
      quoteStateList:"1,2",
    }
  })
}

/**
 * 不分页
 * @param data
 * @returns {*|Promise<*>}
 */
export function quoteOrderList(data = {}) {
  return request({
    url: `${mesUrl}quote/order/list`,
    method: 'get',
    params: data
  })
}
/**
 * 删除
 * @param id
 * @returns {*|Promise<*>}
 */
export function quoteOrderDeleteById(id = '') {
  return request({
    url: `${mesUrl}quote/order/d/${id}`,
    method: 'post'
  })
}


export function quoteOrderGetById(id = '') {
  return request({
    url: `${mesUrl}quote/order/${id}`,
    method: 'get'
  })
}

export function quoteConfirmOrderGetById(id = '') {
  return request({
    url: `${mesUrl}quote/confirm/${id}`,
    method: 'get'
  })
}

export function getDictExtraList () {
  return request({
    url: `${adminUrl}dict/type/quote_extra`,
    method: "get",
  });
}

//http://150.139.130.3:20026/platform/dict/item?pageNum=1&pageSize=10&field=&sort=&type=quote_extra
export function getExtraDictPage () {
  return request({
    url: `${adminUrl}dict/item`,
    method: "get",
    params: {type:'quote_extra'}
  });
}
